Dashboard Temp Share Shortlinks Frames API

HTMLify

Sort An Array of 0s, 1s and 2s.cpp
Views: 1 | Author: cody
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <bits/stdc++.h> 
bool compare(int a, int b){
    if( a < b){
        return true;
    }
    return false;
}

void sortArray(vector<int>& arr, int n)
{
    // Write your code here
    sort(arr.begin(), arr.end(), compare);
}